﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace FACUI.BasicClass
{
    public class 传感器分组
    {
        private string _strName = string.Empty;
        /************************************/
        [Browsable(false)]
        public string 区段名称
        {
            get { return "6950G"; }
            set { ;}
        }
        [Browsable(false)]
        public string 区段状态
        {
            get { return "空闲"; }
            set { ;}
        }
        [Browsable(false)]
        public int 区段剩余轴数
        {
            get { return 0; }
            set { ;}
        }
        /***********************************/
        /// <summary>
        /// 计轴点编号
        /// </summary>
        public string 计轴点编号
        {
            get { return _strName; }
            set { ;}
        }
        /// <summary>
        /// 计轴总数
        /// </summary>
        public int 计轴总数
        {
            get
            {
                //return 32;
                if (CGlobal.CurDrawGroup == null)
                {
                    return 0;
                }
                return CGlobal.CurDrawGroup.iAxleNum;
            }
            set { ;}
        }
        /// <summary>
        /// 测算速度
        /// </summary>
        public string 测算速度
        {
            get 
            {
                //return string.Format("{0}km/h", 201);
                double _ds = CGlobal.dTimeSpan;
                if (_ds > 0)
                {
                    return string.Format("{0}km/h", Math.Round(3.6d*2.7d/_ds,2));
                }
                return "0"; 
            }
            set { ;}
        }
        private double _dlBase1 = 0;
        /// <summary>
        /// 传感器1基准波长
        /// </summary>
        public double 传感器1基准波长
        {
            get { return _dlBase1; }
            set { ;}
        }
        /// <summary>
        /// 传感器1波长最大偏移量
        /// </summary>
        public string 传感器1波长最大偏移量
        {
            get { return "±1.500nm"; }
            set { ;}
        }

        private double _dlReadl1 = 0;
        /// <summary>
        /// 传感器1当前波长
        /// </summary>
        public double 传感器1当前波长
        {
            get 
            {
                if (CGlobal.CurDrawGroup == null)
                {
                    return  _dlReadl1=传感器1基准波长;
                }
                return _dlReadl1 = CGlobal.CurDrawGroup.sensor1.dblReal;
            }
            set { _dlReadl1 = CGlobal.CurDrawGroup.sensor1.dblReal; }
        }
        /// <summary>
        /// 传感器1计轴数
        /// </summary>
        [Browsable(false)]
        public int 传感器1计轴数
        {
            get { return 计轴总数; }
            set { ;}
        }


        private double _dlBase2 = 0;
        /// <summary>
        /// 传感器2基准波长
        /// </summary>
        public double 传感器2基准波长
        {
            get { return _dlBase2; }
            set { ;}
        }
        /// <summary>
        /// 传感器2波长最大偏移量
        /// </summary>
        public string 传感器2波长最大偏移量
        {
            get { return "±1.500nm"; }
            set { ;}
        }

        private double _dlReadl2 = 0;
        /// <summary>
        /// 传感器2当前波长
        /// </summary>
        public double 传感器2当前波长
        {
            get
            {
                if (CGlobal.CurDrawGroup == null)
                {
                    return _dlReadl2 = 传感器2基准波长;
                }
                return _dlReadl2 = CGlobal.CurDrawGroup.sensor2.dblReal;
            }
            set { _dlReadl2 = CGlobal.CurDrawGroup.sensor2.dblReal; }
        }
        /// <summary>
        /// 传感器2计轴数
        /// </summary>
        [Browsable(false)]
        public int 传感器2计轴数
        {
            get { return 计轴总数; }
            set { ;}
        }

        /// <summary>
        /// 传感器分组
        /// </summary>
        public 传感器分组(LxGroup group)
        {
            _strName = group.text;
            _dlBase1 = group.sensor1.dblBase;
            _dlBase2 = group.sensor2.dblBase;
        }
        
    }
}
